Class ZipArchive

java.lang.Object
   |
   +----ZipArchive

public class ZipArchive
extends Object
This class is used to manage Zip archive, it can create, add files, delete files in the archive

Version:
1.0
Author:
Frank Moisant - Patrick Titiano

Variable Index

 o table
 o zipFileName
 o zipFileOpen

Constructor Index

 o ZipArchive()
ZipArchive constructor, it initialize the zipArchive

Method Index

 o addFileToTheArchive(Vector, int)
Add files into the current zip Archive
 o addFileToTheNewArchive(String, Vector, int)
Create a new archive with selected files
 o deleteFilesFromArchive(Vector)
This method delete all selected files in the archive
 o extractFileFromTheArchive(Vector, String)
Extract file from the current archive
 o getTable()
This method return the table to display, with all file information
 o isSelected()
This method return the state of zipArchive
 o setArchiveName(String)
This method select an archive an call the setTable() method
 o setTable()
This method extract the information of the archive, and put them in a vector of rows.

Variables

 o zipFileName
 private String zipFileName
 o table
 private Vector table
 o zipFileOpen
 private boolean zipFileOpen

Constructors

 o ZipArchive
 public ZipArchive()
ZipArchive constructor, it initialize the zipArchive

Methods

 o setArchiveName
 public boolean setArchiveName(String zipFileName)
This method select an archive an call the setTable() method

Parameters:
zipFileName - the path + name of the archive to open
Returns:
true if the archive exist and not comrupted
 o isSelected
 public boolean isSelected()
This method return the state of zipArchive

Returns:
true if an archive is opened
 o getTable
 public Vector getTable()
This method return the table to display, with all file information

Returns:
the table to dispay
 o setTable
 private boolean setTable()
This method extract the information of the archive, and put them in a vector of rows. ready to display.

Returns:
true if the archive is valid
 o deleteFilesFromArchive
 public boolean deleteFilesFromArchive(Vector toDelete)
This method delete all selected files in the archive

Parameters:
toDelete - vector of name of entries
Returns:
true if the operation finish successfully
 o addFileToTheNewArchive
 public boolean addFileToTheNewArchive(String name,
                                       Vector filesToAdd,
                                       int positionInPathName)
Create a new archive with selected files

Parameters:
name - the name of the archive to create
filesToAdd - vector of file names to add in this new archive
positionInPathName - index of the path should have been truncated, to save relative path
Returns:
true if the operation finish successfully
 o addFileToTheArchive
 public boolean addFileToTheArchive(Vector filesToAdd,
                                    int positionInPathName)
Add files into the current zip Archive

Parameters:
filesToAdd - vector of file name
positionInPathName - index of the path should have been truncated, to save relative path
Returns:
true if the operation finish successfully
 o extractFileFromTheArchive
 public boolean extractFileFromTheArchive(Vector toExtract,
                                          String pathToExtract)
Extract file from the current archive

Parameters:
toExtract - vector of entry name to extract
pathToExtract - the directory where extract the selected entries
Returns:
true if the operation finish successfully